package org.colafries.admin.service.impl.index;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.colafries.admin.entity.domain.index.DerivativeIdxConditionRel;
import org.colafries.admin.mapper.index.DerivIdxCondRelMapper;
import org.colafries.admin.service.index.IDerivativeIdxCondRelService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 派生指标与业务限定关系表 服务实现类
 * </p>
 *
 * @author Ann
 * @since 2024-06-03
 */
@Service
public class IDerivativeIdxCondRelServiceImpl extends ServiceImpl<DerivIdxCondRelMapper, DerivativeIdxConditionRel> implements IDerivativeIdxCondRelService {

    @Override
    public void removeByDerivativeCode(Long derivativeIdxCode) {
        baseMapper.delete(Wrappers.<DerivativeIdxConditionRel>lambdaQuery().eq(DerivativeIdxConditionRel::getDerivativeIdxCode, derivativeIdxCode));
    }

    @Override
    public List<DerivativeIdxConditionRel> listByDerivativeCode(Long derivativeIdxCode) {
        return baseMapper.selectList(
                Wrappers.<DerivativeIdxConditionRel>lambdaQuery().eq(DerivativeIdxConditionRel::getDerivativeIdxCode, derivativeIdxCode)
        );
    }
}
